﻿import org.apache.commons.codec.net.URLCodec;
import org.apache.commons.codec.DecoderException;

class EncoderTagLib {
	def decodeString = { attr->
		URLCodec urlCodec = new URLCodec();
		String str = attr['value'];	
		try {
			str = urlCodec.decode(str);
//            str = new String(str.getBytes("utf8"),"utf8");
            out << str;
		} catch (DecoderException e) {
			out << str;
		}
	}
	def encodeString = { attr->
		URLCodec urlCodec = new URLCodec();
		String str = attr['value'];	
		try {
			str = urlCodec.encode(str);
			out << str;
		} catch (DecoderException e) {
			out << str;
		}
	}
}